home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr22 / moreram1.zip / MORERAM1.ASM < prev    next >
Assembly Source File  |  1993-05-01  |  3KB  |  143 lines

  1. TITLE    MORERAM    10-27-88    [10-28-88]
  2.  
  3. ;Disassembly, tweak
  4. ;David Kirschbaum
  5. ;Toad Hall
  6. ;kirsch@braggvax.ARPA
  7.  
  8. LF    EQU    0AH
  9. CR    EQU    0DH
  10.  
  11. CSEG    SEGMENT
  12.     ASSUME DS:CSEG, SS:CSEG ,CS:CSEG ,ES:CSEG
  13.  
  14.     org    2
  15. currmem    dw    ?            ;PSP current memory
  16.  
  17.     ORG    100H
  18.  
  19. MoreRam    proc    near
  20.     JMP    Start_1CA
  21.  
  22. L0103    DB    "MORE RAM than switches (v 1.1) by Daniel M. O'Brien "
  23.     db    '(21 Dec 1983)',CR,LF        ;,'$'
  24. L0147    DB    ' Current memory is $'
  25. L015B    DB    ' K bytes. $'
  26. L0166    DB    CR,LF,' Physical memory is $'
  27. L017D    DB    ' Analyzing & Clearing...$'
  28. L0196    DB    ' Re-Booting...',CR,LF,'$'
  29. L01A7    DB    CR,LF,' Memory size is set correctly.',CR,LF,'$'
  30. MoreRam    endp
  31.  
  32.  
  33. Start_1CA    proc    near
  34.     MOV    DX,OFFSET L0103        ;'MORE RAM' intro
  35.     MOV    AH,9
  36.     INT    21H
  37. ;    MOV    DX,OFFSET L0147        ;'Current memory is '
  38. ;    MOV    AH,9
  39. ;    INT    21H
  40.     MOV    AX,currmem    ;DS:2    ;get current memory from PSP
  41.     PUSH    DS            ;save DS
  42.     PUSH    AX            ;save PSP memory value
  43.     MOV    CL,6            ;convert paras to Kb
  44.     SHR    AX,CL
  45.     CALL    Display_Int_25C        ;display memory size
  46.     MOV    DX,OFFSET L015B        ;'K bytes'
  47.     MOV    AH,9
  48.     INT    21H
  49.     MOV    DX,OFFSET L017D        ;'Analyzing and clearing..'
  50.     MOV    AH,9
  51.     INT    21H
  52.     XOR    AX,AX
  53.     OUT    0A0H,AL            ;disable NMI
  54.     POP    AX            ;restore PSP memory value
  55. SegLup_1F7:
  56.     xor    bx,bx
  57.     CMP    AX,0B000H        ;hit max?
  58.     JZ    L0219            ;yep, done with clearing
  59.     MOV    DS,AX            ;point DS to last memory seg
  60.     MOV    [BX],AX            ;stuff seg nr at segment base
  61.     MOV    CX,[BX]            ;see if it really took (real RAM)
  62.     CMP    AX,CX            ;did we stuff the number to real RAM?
  63.     JNZ    L0219
  64.      MOV    CX,8            ;gonna store 16 zeroes
  65.      MOV    ES,AX            ;point to current segment
  66.      XOR    AX,AX
  67.      XOR    DI,DI            ;segment base
  68.      REPZ    STOSW            ;clear with 16 zeroes
  69.      MOV    AX,DS            ;get last memory seg
  70.      INC    AX            ;bump to next segment
  71.      JMP    SHORT    SegLup_1F7    ;and go until maxed out
  72.  
  73. L0219:    MOV    BX,AX            ;save last seg a second
  74.     MOV    AL,80H
  75.     OUT    0A0H,AL            ;?reenable NMI or maybe clear error
  76.     MOV    AX,BX            ;get last seg back
  77.     MOV    CL,6
  78.     SHR    AX,CL            ;convert paras to Kb
  79.     MOV    BX,40H            ;BIOS seg
  80.     MOV    DS,BX
  81.     ASSUME    DS:Nothing
  82.  
  83.     MOV    BX,13H            ;413H=available memory
  84.     CMP    [BX],AX            ;BIOS knows the truth?
  85.     JZ    No_Action_252        ;true memory is set on switches,
  86.                     ;no action required, terminate.
  87.  
  88.     MOV    [BX],AX            ;force true memory into BIOS
  89.     PUSH    AX            ;dumb
  90.     POP    AX            ;but maybe needs to delay a sec?
  91.     POP    DS            ;restore DS
  92.     ASSUME    DS:CSEG
  93.  
  94.     PUSH    AX            ;save true memory val (Kb)
  95.     MOV    DX,OFFSET L0166        ;'Physical memory is'
  96.     MOV    AH,9
  97.     INT    21H
  98.     POP    AX            ;restore true memory val (Kb)
  99.     CALL    Display_Int_25C        ;display memory size
  100.     MOV    DX,OFFSET L015B        ;'K bytes'
  101.     MOV    AH,9
  102.     INT    21H
  103.     MOV    DX,OFFSET L0196        ;'Rebooting'
  104.     MOV    AH,9
  105.     INT    21H
  106.     INT    19H            ;Reboot
  107.  
  108. ;L0252      L022F CJ
  109. No_Action_252:
  110.     POP    DS
  111.     ASSUME    DS:CSEG
  112.  
  113.     MOV    DX,OFFSET L01A7        ;'Memory size is set correctly'
  114.     MOV    AH,9
  115.     INT    21H
  116.     INT    20H            ;terminate
  117.  
  118. Start_1CA    endp
  119.  
  120.  
  121. ;L025C      L01E1 CC  L023F CC
  122. ;Display an integer in AX
  123. ;Doesn't matter if we destroy all regs
  124. Display_Int_25C    proc    near
  125.     XOR    CX,CX            ;clear digit counter
  126.     MOV    BX,0AH            ;10 constant divisor
  127. Lup265:    XOR    DX,DX            ;clear remainder
  128.     DIV    BX            ;integer /10
  129.     ADD    DX,'00'            ;asciify remainder
  130.     PUSH    DX            ;push DL on stack
  131.     INC    CX            ;count the pushes
  132.     OR    AX,AX            ;integer zeroed out?
  133.     JNZ    Lup265            ;nope, keep going
  134. Lup273:    POP    DX            ;Ascii digit in DL
  135.     MOV    AH,2            ;display char
  136.     INT    21H
  137.     LOOP    Lup273            ;for each push
  138.     RET    ;_NEAR
  139. Display_Int_25C    endp
  140.  
  141. Cseg    ENDS
  142.     END    MoreRam
  143.